package com.whut.service.impl;


import com.whut.mapper.GreenprojectinfoMapper;
import com.whut.model.Greenprojectinfo;
import com.whut.service.GreenProjectService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class GreenProjectServiceImpl implements GreenProjectService {
    @Resource
    private GreenprojectinfoMapper greenprojectinfoMapper;

    /*
     * @author: wxd
     * @Description: 获取绿化工程所有信息
     * @date: 2020/9/22 16:43
     * @param: []
     */
    @Override
    public Object getGreenProjectInfo() {
        return greenprojectinfoMapper.getGreenProjectInfo();
    }


    /*
     * @author: wxd
     * @Description: 插入一条绿化工程信息
     * @date: 2020/9/22 16:43
     * @param: [values]
     */
    @Override
    public String addGreenProjectInfo(Greenprojectinfo values) {
        try {
            greenprojectinfoMapper.insert(values);
            return "success";
        } catch (Exception e) {
            e.printStackTrace();
            return "error";
        }
    }

    /*
     * @author: wxd
     * @Description: 删除一条绿化工程信息
     * @date: 2020/9/22 16:43
     * @param: [mKey]
     */
    @Override
    public String deleteGreenProjectInfo(int mKey) {
        try {
            greenprojectinfoMapper.deleteByPrimaryKey(mKey);
            return "success";
        } catch (Exception e) {
            e.printStackTrace();
            return "error";
        }
    }

    /*
     * @author: wxd
     * @Description: 修改一条绿化工程信息
     * @date: 2020/9/22 16:43
     * @param: [values]
     */
    @Override
    public String modifyGreenProjectInfo(Greenprojectinfo values) {
        try {
            greenprojectinfoMapper.updateByPrimaryKeySelective(values);
            return "success";
        } catch (Exception e) {
            e.printStackTrace();
            return "error";
        }
    }

    /*
     * @author: wxd
     * @Description: 根据项目名称搜索绿化工程信息
     * @date: 2020/9/22 16:44
     * @param: [project_name]
     */
    @Override
    public Object searchGreenProjectInfoByProject_Name(String project_name) {
        return greenprojectinfoMapper.searchGreenProjectInfoByProject_Name(project_name);
    }
}
